<?php
include "../../fun.php";
$db=conndb();
isLogin();
$page=isset($_GET["page"])?$_GET["page"]:1;
$limit=isset($_GET["limit"])?$_GET["limit"]:5;
$solution_name=isset($_GET["solution_name"])?$_GET["solution_name"]:'';
$sortid=isset($_GET["sortid"])?$_GET["sortid"]:"";
$where='';
if ($solution_name) {
    $where.="and solution_name like '%{$solution_name}%'";
}
if ($sortid) {
    $where.="and sortid='{$sortid}'";
}
if ($where) {
    $where="where".substr($where, 3);
}
$sql_count="select count(*) as count from solution {$where}";
$res_count=query1($db, $sql_count, false);
$count=$res_count["count"];
$start=($page-1)*$limit;
$sql="select a.*,b.sortname from solution as a left join sortclass as b on a.sortid=b.id {$where} order by a.id desc limit {$start},{$limit}";
$re=query1($db, $sql);
$data=["code"=>0,"msg"=>"操作成功","data"=>$re,"count"=>$count];
echo json_encode($data, JSON_UNESCAPED_UNICODE);
